package f5transformation;

import flinkemp.Emp;
import flinkemp.EmpFun;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class MapSal {
    public static void main(String[] args)throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<Emp> data = env.addSource(new EmpFun());
        data.print();
        SingleOutputStreamOperator<String> sal = data.map(new MyMap());
        sal.print();
        env.execute();

    }

    public static class MyMap implements MapFunction<Emp,String>{
        @Override
        public String map(Emp emp){
            return "薪资:"+emp.sal;
        }
    }
}
